<template>
  <div class="custom-table-wrapper">
    <el-table
      ref="table"
      v-bind="$attrs"
      v-on="$listeners"
      :data="data"
      class="custom-table"
    >
      <slot></slot>
    </el-table>
    <!-- <el-pagination
      v-if="isPage"
      class="table-pagination"
      background
      :total="1000"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="currentPage1"
      :page-size="100"
      layout="total, prev, pager, next"
    >
    </el-pagination> -->
    <el-pagination
      v-if="isPage"
      background
      layout="total, prev, pager, next,sizes"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="queryInfo.page"
      :page-size.sync="queryInfo.limit"
      :page-sizes="[20, 50, 100, 200]"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "CustomTable",
  props: {
    data: {
      type: Array,
      default: () => [],
    },
    isPage: {
      type: Boolean,
      default: true,
    },
    queryInfo:{
      type: Object
    },
    total:{
      type: Number,
      default: 0,
    }
  },
  methods:{
    handleSizeChange(limit){
      // this.$emit("update:queryInfo-page",9)
      this.$emit("changePage")
      console.log(limit)
    },
    handleCurrentChange(){
       this.$emit("changePage")
      console.log(456)
    }
  }
};
</script>

<style scoped>
.custom-table-wrapper {
  border: 1px solid #f8f8f9;
  border-radius: 12px;
  overflow: hidden;
}
.custom-table {
  /* 你的自定义样式 */
  /* border-top-radius: 12px; */
}
/deep/ .el-table::before {
  height: 0 !important;
}
.custom-table >>> .el-table__row td {
  border-color: #f8f8f9;
}
/* .custom-table  >>> .el-table__row:last-child td{
  border-bottom: none;
} */
.custom-table >>> .el-table__body tr:hover > td {
  background-color: #f8f8f9;
}
.custom-table th {
  background-color: #f8f8f9;
}
.table-pagination {
  padding: 16px 0;
}
</style>